package com.futao;

import org.joda.time.DateTime;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author futao
 * Created on 18-6-6-下午7:17.
 * 定时任务
 * 在线cron生成
 * http://cron.qqe2.com/
 */
@Component
public class TaskService {
    private static int a = 1000;

    //    @Scheduled(cron = "0 0 0 2,31 1,12 1 2013-2014")
    @Async
    public void showTime() {
        String nowTime = DateTime.now().toString();
        System.out.println("=================" + nowTime);
        a += 1;
        System.out.println(a);
    }

    //    @Scheduled(cron = "0 0 0 2,31 1,12 1 2013-2014")
    @Async
    public void showTime3() {
        String nowTime = DateTime.now().toString();
        System.out.println("=================" + nowTime);
        System.out.println(a);
    }

    //    @Scheduled(cron = "0 0 0 2,31 1,12 1 2013-2014")
    @Async
    public void showTime2() {
        String nowTime = DateTime.now().toString();
        System.out.println("=================" + nowTime);
        a += 1;
        System.out.println(a);
    }


}
